import {createRouter, createWebHashHistory} from "vue-router";
import {progress} from "@/utils/progress.js";
import constantRoutes from './router.js';
import {permissionController} from "@/router/permission.js";

const router = createRouter({
    history: createWebHashHistory(import.meta.env.BASE_URL),
    routes: constantRoutes,
    scrollBehavior: () => ({left: 0, top: 0}),
});

router.beforeEach(permissionController);

router.afterEach((to, from) => {
    progress().done();
});

export default router;
